package com.zwz.mapper;

import com.zwz.entity.RiskInfoMain;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;

import org.apache.ibatis.annotations.*;

@Mapper
public interface RiskInfoMainMapper {
    @Insert("INSERT INTO risk_info_main (company_id) VALUES (#{companyId})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(RiskInfoMain entity);

    @Update("UPDATE risk_info_main SET company_id = #{companyId} WHERE id = #{id}")
    int update(RiskInfoMain entity);

    @Delete("DELETE FROM risk_info_main WHERE id = #{id}")
    int deleteById(Integer id);

    @Select("SELECT * FROM risk_info_main WHERE id = #{id}")
    @Results(id = "riskInfoResultMap", value = {
            @Result(property = "id", column = "id"),
            @Result(property = "companyId", column = "company_id"),
            @Result(property = "createdAt", column = "created_at"),
            @Result(property = "updatedAt", column = "updated_at")
    })
    RiskInfoMain selectById(Integer id);
}


